/* eslint-disable no-use-before-define */
/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 *
 * @format
 * @flow
 */

import React from 'react';
import { Provider } from 'mobx-react';
import { Router } from 'react-native-router-flux'
import overlay from './config/router'
import stores from './store'
import AV from 'leancloud-storage'
import config from './config'

class App extends React.Component {

  constructor(props) {
    super(props)

    AV.init({
      appId: config.LeanCloudAppid,
      appKey: config.LeanCloudAppKey,
      serverURLs: config.LeanCloudServerUrls,
    })
    AV.debug.enable();
  }

  render() {
    return (
      <Router
        scenes={overlay}
        tintColor="white"
      />
    )
  }
}


// eslint-disable-next-line react/no-multi-comp
const initApp = () => {
  return (
    <Provider {...stores}>
      <App />
    </Provider>
  )
}

export default initApp;
